<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Material extends Model
{
    const TYPE_NEWS = 'news';
    const TYPE_IMAGE = 'image';
    const TYPE_TEXT = 'text';

    public static $typesMap = [
        self::TYPE_IMAGE => '图片',
        self::TYPE_NEWS => '图文',
        self::TYPE_TEXT => '文字',
    ];

    protected $fillable = [
        'type', 'media_id', 'index', 'title', 'thumb_media_id', 'show_cover_pic',
        'author', 'digest', 'content', 'content_source_url', 'url', 'update_time',
        'name', 'thumb_url', 'need_open_comment', 'only_fans_can_comment',
    ];

    public function keywordReply()
    {
        return $this->hasMany(KeywordReply::class, 'material_id');
    }
}
